<script type="text/javascript">
//<![CDATA[
	function frmValid(){
		with(document.frmReg){
			if(!zipcode1.value || !zipcode2.value || !addr2.value){
				alert("주소를 정확히 입력해 주세요");
				return;
			}

			var tel = tel1.value+'-'+tel2.value+'-'+tel3.value;
			if(!telRegEx.test(tel)){
				alert("전화번호를 정확히 입력해주세요");
				return;
			}

			var fax = fax1.value+'-'+fax2.value+'-'+fax3.value;
			if(!telRegEx.test(fax)){
				alert("팩스번호를 정확히 입력해주세요");
				return;
			}


			if(checkEmpty(admin_name)){
				alert('관리자명을 입력해주세요');
				admin_name.focus();
				return;
			}

			var email = mail_id.value+'@'+mail_domain.value;
			if(!checkEmail(email)){
				alert('관리자메일을 정확히 입력해주세요');
				return;
			}

			if(checkEmpty(minister)){
				alert('목사님 성명을 입력해주세요');
				minister.focus();
				return;
			}
			submit();
		}
	}

	$(function(){
		$("[name=domain_support]").change(function(){
			if($(this).val()){
				$("[name=mail_domain]").attr("readonly",true);
				$("[name=mail_domain]").val($(this).val());
			}else{
				$("[name=mail_domain]").attr("readonly",false);
				$("[name=mail_domain]").val('');
				$("[name=mail_domain]").focus();
			}
		});	
	});
//]]>
</script>

<!--[s] 우편번호 검색 레이어 -->
<div id="layerBg"></div>
<div id="layerArea" class="layer_add"></div>
<!--[e] 우편번호 검색 레이어 -->

<div class="box_type02">
	<h2 class="txt">사이트정보</h2>
	<p class="icon"><a href="javascript:void(0);" class="icon_m04">매뉴얼</a></p>

	<!--[s] 쓰기 -->
	<form name="frmReg" method="post" action="/setting/siteinfoDbjob" enctype="multipart/form-data">
	<input type="hidden" name="dbjob" value="<?php echo $dbjob; ?>" />
		<fieldset class="board_write">
			<legend>사이트정보</legend>
			<table cellspacing="0" summary="사이트정보" class="lines">
				<caption>사이트정보</caption>
				<tr>
					<th scope="row" width="128"><p class="point">주소</p></th>
					<td>
						<div>
							<p>
								<input type="text" id="" name="zipcode1" readonly class="ip_i" style="width:23px;" value="<?php echo $zipcode1; ?>" />
								<span class="txt_type01">-</span>
								<input type="text" id="" name="zipcode2" readonly class="ip_i" style="width:23px;" value="<?php echo $zipcode2; ?>" />
								<a href="javascript:findpost('obj1=frmReg.zipcode1&obj2=frmReg.zipcode2&obj3=frmReg.addr1');"><img src="/theme/<?=$_theme?>/images/common/btn_add.gif" class="vam ml6" alt="우편번호찾기" /></a>
							</p>
							<p class="mt4"><input type="text" id="" name="addr1" readonly class="ip_i" style="width:595px;" value="<?php echo $addr1; ?>" /></p>
							<p class="mt4"><input type="text" id="" name="addr2" class="ip_i" style="width:595px;" value="<?php echo $addr2; ?>" /></p>
						</div>
					</td>
				</tr>
				<tr>
					<th scope="row"><p class="point">전화번호</p></th>
					<td>
						<div>
							<input type="text" id="" name="tel1" maxlength="3" class="ip_i" style="width:23px;" value="<?php echo $tel1;?>" />
							<span class="txt_type01">-</span>
							<input type="text" id="" name="tel2" maxlength="4" class="ip_i" style="width:43px;" value="<?php echo $tel2;?>" />
							<span class="txt_type01">-</span>
							<input type="text" id="" name="tel3" maxlength="4" class="ip_i" style="width:43px;" value="<?php echo $tel3?>" />
						</div>
					</td>
				</tr>
				<tr>
					<th scope="row"><p class="point">팩스</p></th>
					<td>
						<div>
							<input type="text" id="" name="fax1" maxlength="3"  class="ip_i" style="width:23px;" value="<?php echo $fax1;?>" />
							<span class="txt_type01">-</span>
							<input type="text" id="" name="fax2" maxlength="4"  class="ip_i" style="width:43px;" value="<?php echo $fax2;?>" />
							<span class="txt_type01">-</span>
							<input type="text" id="" name="fax3" maxlength="4"  class="ip_i" style="width:43px;" value="<?php echo $fax3;?>" />
						</div>
					</td>
				</tr>
				<tr>
					<th scope="row"><p class="point">관리자명</p></th>
					<td>
						<div>
							<input type="text" id="" name="admin_name" class="ip_i" style="width:181px;" value="<?php echo $admin_name;?>" />
						</div>
					</td>
				</tr>
				<tr>
					<th scope="row"><p class="point">관리자메일</p></th>
					<td>
						<div>
							<input type="text" id="" name="mail_id" class="ip_i" style="width:155px;" value="<?php echo $mail_id;?>" />
							<span class="txt_type01">@</span>
							<input type="text" id="" name="mail_domain" class="ip_i" style="width:155px;" value="<?php echo $mail_domain;?>" />
							<select name="domain_support" class="ip_s ml6" style="width:130px;">
								<option value="">직접입력</option>
								<?php 
									foreach($this->config->item('ch_mail_domain') as $key){
										$selected = ($key == $mail_domain) ? 'selected' :'';
										echo "<option value=\"{$key}\" {$selected}>{$key}</option>\n";
									}
								?>
							</select>
						</div>
					</td>
				</tr>
				<tr>
					<th scope="row"><p class="point">목사님 성명</p></th>
					<td>
						<div>
							<input type="text" id="" name="minister" class="ip_i" style="width:181px;" value="<?php echo $minister;?>" />
						</div>
					</td>
				</tr>
				<tr>
					<th scope="row"><p class="point">목사님 사진</p></th>
					<td>
						<div>
							<input type="file" id="" name="file1" class="ip_i" style="width:100%;" value="" />
							<!--<input type="text" id="" name="" class="ip_i" style="width:279px;" value="" />
							<a href="javascript:void(0);" class="btn_search">찾아보기</a>  -->
						</div>
					</td>
				</tr>
			</table>
		</fieldset>
		<!--[e] 쓰기 -->
	</form>
	
	<!-- [s] 버튼 -->
	<ul class="botton_box mt30">
		<li class="center">
			<?php 
				//버튼 이미지 변경
				$btn_image = ($dbjob == 'i') ? 'btn_ok.gif' : 'btn_modify.gif';
			?>
			<a href="javascript:frmValid()"><img src="/theme/<?=$_theme?>/images/common/<?php echo $btn_image;?>" alt="확인" /></a>
			<a href="javascript:history.back();"><img src="/theme/<?=$_theme?>/images/common/btn_cancel.gif" alt="취소" /></a>
			
			
		</li>
	</ul>
	<!-- [e] 버튼 -->

	<!--[s] Tip -->
	<dl id="tip" class="mt30">
		<dt>Tip</dt>
		<dd>인터넷익스플로러의 '호환성보기' 기능을 사용중인 접속자에게 자동으로 최신버전 기준으로 사이트를 출력하도록 처리합니다.</dd>
		<dd>코딩방식에 따라 특정 버전의 브라우저에서 사이트가 깨질수 있으니, 충분한 테스트 후 기능을 설정해 주시기 바랍니다.</dd>
	</dl>
	<!--[e] Tip -->
</div>
